<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>01_JS回顾</title>
</head>
<body>
<script>
    var a = 10;
    var b = 2.2;
    var c = "hello";
    var c2 = 'hello2';
    var d = true;
    var e = false;
    var f;
    console.log(a,typeof a);//number
    console.log(b,typeof b);//number
    console.log(c,typeof c);//string
    console.log(c2,typeof c2);//string
    console.log(d,typeof d);//boolean
    console.log(e,typeof e);//boolean
    console.log(f,typeof f);//undefined

    let obj = {};
    console.log(obj,typeof obj);
    obj.like = "过新年";
    console.log(obj,typeof obj,obj.like);

    let arr = [1,true,'hello'];
    console.log(arr,typeof arr);//object
    console.log(arr[0],arr[1],arr[2],arr[99]);//undefined

    console.log(Number('23'),typeof Number('23'));//23
    console.log(Number(true),typeof Number(true));//1
    console.log(Number(false),typeof Number(false));//0
    console.log(Number('哈哈哈'),typeof Number('哈哈哈'));//NaN
    console.log(Number('7a'),typeof Number('7a'));//NaN
    //以下5个全是false ，其余的都是 true
    console.log(Boolean(0),typeof Boolean(0));
    console.log(Boolean(null),typeof Boolean(null));
    console.log(Boolean(''),typeof Boolean(''));
    console.log(Boolean(NaN),typeof Boolean(NaN));
    console.log(Boolean(undefined),typeof Boolean(undefined));

    let x = 1;
    let y = true;
    console.log(x == y);//true 松散比较运算符
    console.log(x === y);//false 严格比较运算符
    console.log(3 > 7);
    console.log(3 > '7');
    console.log('3' > '7');
    console.log('3'.charCodeAt());//51
    console.log('7'.charCodeAt());//55
</script>
</body>
</html>